'use strict';

requirejs.config({
    paths: {
        'jQuery': ['../bower_components/jquery/dist/jquery'],
        'angular': ['../bower_components/angular/angular'],
        'uiRoute': ['../bower_components/angular-ui-router/release/angular-ui-router'],
        'ngResource': ['../bower_components/angular-resource/angular-resource']/*,
         'cookie': ['../lib/angularjs/angular-cookies'],
         'upload': ['../lib/angular-file-upload/ng-file-upload'],
         'focusOn': ['../lib/ng-focus-on/ng-focus-on'],
         'ui-select2': ['../lib/ui-select2/ui-select2'],
         'select2': ['../lib/select2/select2'],
         'chartjs': ['../lib/chartjs/Chart']*/
    },
    shim: {
        'jQuery': {
            exports: 'jQuery'
        },
        'angular': {
            deps: ['jQuery'],
            exports: 'angular'
        },
        'uiRoute': {
            deps: ['angular']
        },
        'ngResource': {
            deps: ['angular']
        }/*,
         'cookie': {
         deps: ['angular']
         },
         'upload': {
         deps: ['angular']
         },
         'focusOn': {
         deps: ['angular']
         },
         'ui-select2': {
         deps: ['angular']
         },
         'select2': {
         deps: ['angular']
         },
         'chartjs': {
         deps: ['angular']
         }*/
    }
});
//添加的js文件都要在下面列出来
require(['angular', 'jQuery', 'uiRoute', 'ngResource', './js/controllers', './js/services', './js/login', './js/main'],
    function (angular, controllers) {
        angular.module('myApp', ['myApp.controllers', 'myApp.services', 'ngResource', 'ui.router.state', 'ui.router.router', 'login', 'main']).
            config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) {
                $urlRouterProvider.when("", "login");
                $stateProvider.state('login', {
                    url: "/login",
                    templateUrl: 'html/login.html',
                    controller: 'LoginCtrl'
                }).state('main', {
                    url: "/main",
                    templateUrl: 'html/main.html',
                    controller: 'MainCtrl'
                });
            }]);
        angular.bootstrap(document, ['myApp']);
    });
